using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Leo.Entities;

namespace Leo.Repository.Mapping
{
    public class VENTAMap : EntityTypeConfiguration<VENTA>
    {
        public VENTAMap()
        {
            // Primary Key
            this.HasKey(t => t.id_Venta);

            // Properties
            this.Property(t => t.fecha)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("VENTA");
            this.Property(t => t.id_Venta).HasColumnName("id_Venta");
            this.Property(t => t.fecha).HasColumnName("fecha");
            this.Property(t => t.id_cliente).HasColumnName("id_cliente");

            // Relationships
            this.HasOptional(t => t.Cliente)
                .WithMany(t => t.VENTAs)
                .HasForeignKey(d => d.id_cliente);

        }
    }
}
